﻿using System.Linq;
using NUnit.Framework;

namespace Microsoft.WowAddonStudio.FrameXml.Serialization.Tests
{
	[TestFixture]
	public class OutfitterTest : SerializationTestBase<Ui>
	{
		[Test]
		public void SerializationTest()
		{
			InitializeTestEntity("Acceptance/Outfitter.xml");

			Assert.IsNotNull(TestEntity);
			Assert.AreEqual(23, TestEntity.LayoutFrames.Count);
		}

		[Test]
		public void VirtualFrameTest()
		{
			InitializeTestEntity("Acceptance/Outfitter.xml");

			Assert.IsNotNull(TestEntity);
			Assert.AreEqual(18, TestEntity.LayoutFrames.Where(frame => frame.Virtual).Count());
			Assert.AreEqual(5, TestEntity.LayoutFrames.Where(frame => !frame.Virtual).Count());
		}

		/// <summary>
		/// Gets the entity to be tested from a <see cref="Ui"/> instance.
		/// </summary>
		/// <param name="ui">The ui instance.</param>
		/// <returns>
		/// An instance of the <typeparamref name="TSerializationObject"/> class.
		/// </returns>
		protected override Ui GetTestEntity(Ui ui)
		{
			return ui;
		}
	}
}